package com.androidviewx;

import android.os.Bundle;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.xfunc.views.bannertext.TextBannerView;

import java.util.ArrayList;
import java.util.List;

public class DemoTextBannerActivity extends AppCompatActivity {
    TextBannerView banner;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.app_view_activity_banner_text);
         banner = findViewById(R.id.ivSearchBanner);
        banner.setTextColor(R.color.white_60);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 6; i++) {
            list.add("position  "+i);
        }
        banner.setDatas(list);
        banner.setItemOnClickListener((data, position) -> {
          Toast.makeText(this,""+position+"::: "+data,Toast.LENGTH_SHORT).show();
        });
        banner.setTextColor(R.color.purple_200);
    }

    @Override
    protected void onResume() {
        super.onResume();
        banner.startViewAnimator();
    }


    @Override
    protected void onPause() {
        super.onPause();
        banner.stopViewAnimator();
    }
}
